@file:JvmName("Utils")

package com.example.core.utils

import android.content.Context
import android.content.res.Resources
import android.util.TypedValue
import android.widget.Toast
import com.example.core.BaseApplication.Companion.currentApplication

private val displayMetrics = Resources.getSystem().displayMetrics

val Float.px: Float
    get() = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, this, displayMetrics)

fun Context.toast(string: String?, duration: Int = Toast.LENGTH_SHORT) {
    Toast.makeText(currentApplication, string, duration).show()
}